/*
 * @Descripttion: 
 * @version: 
 * @Author: ankeji
 * @Date: 2020-05-27 10:32:50
 * @LastEditors: ankeji
 * @LastEditTime: 2020-07-08 10:03:40
 */ 
/*
 * @Descripttion: 
 * @version: 
 * @Author: ankeji
 * @Date: 2020-05-27 10:32:50
 * @LastEditors: ankeji
 * @LastEditTime: 2020-05-27 10:47:44
 */ 
const Tool = require('./ourtool/ourtool')
const tool = new Tool();
// console.log(tool.formatNum('45612365432132')); //=>45,612,365,432,132.00
function tranNumber(num, point) {
    let numStr = num.toString()
    // 十万以内直接返回 
    if (numStr.length < 5) {
        return numStr;
    }
    //大于8位数是亿
    else if (numStr.length > 8) {
        let decimal = numStr.substring(numStr.length - 8, numStr.length - 8 + point);
        return parseFloat(parseInt(num / 100000000) + '.' + decimal) + '亿+';
    }
    //大于6位数是十万 (以10W分割 10W以下全部显示)
    else if (numStr.length > 4) {
        let decimal = numStr.substring(numStr.length - 4, numStr.length - 4 + point)
        return parseFloat(parseInt(num / 10000) + '.' + decimal) + '万+';
    }
}

console.log(tranNumber('486155',0));
